#include "MatrixLED.h"
#include "Delay.h"

#define MATRIX_LED_PORT P0
sbit RCK = P3^5;	//RCLK
sbit SCK = P3^6;	//SRCLK
sbit SER = P3^4;	//SER   SER为位操作，可以给0或1，若给其一个数据，如0X12，则其认为为1，即非0为1

void MatrixLED_Init(void)
{
	SCK = 0;
	RCK = 0;
}

void _74HC595_WriteByte(unsigned char Byte)
{
	unsigned char i;
	for (i = 0;i < 8;i++)
	{
		SER = Byte & (0X80 >> i);
		SCK = 1;
		SCK = 0;
	}
	RCK = 1;
	RCK = 0;
}

void MatrixLED_ShowColumn(unsigned char Column,Data)
{
	_74HC595_WriteByte(Data);//段选
	MATRIX_LED_PORT = ~(0X80 >> Column);//位选
	Delay1ms(1);
	MATRIX_LED_PORT = ~0X00;
}
